import request from '../../../util/request';
import {userServer} from '../../../config/config';

/**
 * 通过通道和令牌获取登录会话
 */
function getLoginSessionByChannelAndToken() {
	return request(userServer('/api/login/getLoginSessionByChannelAndToken'));
}

/**
 * 通过通道、身份、凭证登录
 */
function login({channel, identity, certification}) {
	return request(userServer('/api/login/login'), {
		data: {channel, identity, certification}
	});
}

/**
 * 通过通道和令牌登出
 */
function logout() {
	return request(userServer('/api/login/logout'));
}

export {
	getLoginSessionByChannelAndToken,
	login,
	logout,
};
